let {getHotsonger} = require("../../api/musict")
Page({

  /**
   * 页面的初始数据
   */
  data: {
    songerList:[],
    initial:-1,
    rightList:['热','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'],
    idTitle:"热门",
    state:true,
 
  },

  /**
   * 生命周期函数--监听页面加载
   */
  async onLoad(options) {

    wx.setNavigationBarTitle({
      title: '歌手',
    })

    let id = this.data.initial;
    let res = await getHotsonger(id);
    console.log(res);
    this.setData({
      songerList:res.data.artists,
    })
  },

  async changeId(e){
    console.log(e);
    console.log(this);
    let id = e.currentTarget.dataset.con
    console.log(id);
    if(id=="热"){
      id=-1;
    }
    let res = await getHotsonger(id);
    this.setData({
      songerList:res.data.artists,
      idTitle:id,
    })
    
  },
  goHotinfo(e){
    console.log(e.currentTarget.dataset.userid);
    let id = e.currentTarget.dataset.userid;
    wx.navigateTo({
      url: '../hotsongs/hotsongs?id='+id,
    })
  }

})